cmake_minimum_required(VERSION 3.5)

project(ThreadPool LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

option(BUILD_EXAMPLES "Build examples" ON)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

set(INTERFACE_FILES thread_pool.hpp thread_safe_queue.hpp)
add_library(${PROJECT_NAME} INTERFACE ${INTERFACE_FILES})
target_link_libraries(${PROJECT_NAME} INTERFACE Threads::Threads)
target_include_directories(${PROJECT_NAME} INTERFACE ${PROJECT_SOURCE_DIR})

if(BUILD_EXAMPLES)
    add_subdirectory(examples)
endif()